﻿using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace NetMicro.Host
{
    /// <summary>
    /// 
    /// </summary>
    public abstract class StartupProvider
    {
        protected readonly IHostEnvironment _env;
        protected readonly IConfiguration _cfg;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="env"></param>
        /// <param name="cfg"></param>
        protected StartupProvider(IHostEnvironment env, IConfiguration cfg)
        {
            _env = env;
            _cfg = cfg;

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="services"></param>
        public virtual void ConfigureServices(IServiceCollection services)
        {
            services.AddWebHost(new ServiceCollectionOptions(), _env, _cfg);

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="app"></param>
        public virtual void Configure(IApplicationBuilder app)
        {
            app.UseWebHost(new ApplicationBuilderOptions(), _env);
        }
    }
}
